package edu.study.api.common.enums;

import lombok.Getter;

@Getter
public enum StatusTypeEnum implements BaseStrEnum {
	Y("Y", "是"),
	N("N", "否"),

    OK("", "正常"),
    PUBLISH("PUBLISH", "发布"),

    DRAFT("DRAFT", "草稿"),

    ENABLE("ENABLE", "启用"),
    DISABLE("DISABLE", "禁用"),

    VALID("VALID", "有效"),
    INVALID("INVALID", "失效");

    private String code;
    private String message;

    StatusTypeEnum(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static StatusTypeEnum parseCode(String code) {
        for (StatusTypeEnum result : values()) {
            if (result.getCode().equals(code)) {
                return result;
            }
        }
        return null;
    }
    
    public static String getMessageFromCode(String code) {
        for (StatusTypeEnum result : values()) {
            if (result.getCode().equals(code)) {
                return result.getMessage();
            }
        }
        return null;
    }
}
